package trunk.res;

import com.sun.org.apache.bcel.internal.generic.NEW;

import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*;
import java.io.File;

/**
 * all resource variables defines here, easy to use, and easy to change
 * Created by IntelliJ IDEA.
 * User: yipeipei
 * Date: 12/5/11
 * Time: 1:22 PM
 * To change this template use File | Settings | File Templates.
 */
public final class R {
    public static final class attribute {
        public static final String DEBUG_PATH = System.getProperty("user.dir");
        //path from your driver letter to the project home, general as  C:/.../InstructionFlowSimulator, end WITHOUT a file separator.

        public static final String CHARSET = System.getProperty("file.encoding");   //default for the system
        public static final Font FONT = new Font("微软雅黑", Font.PLAIN, 12); //default for displaying in the simulator

        public static final Dimension SCREEN_SIZE = Toolkit.getDefaultToolkit().getScreenSize();    //get size of current screen

        public static final Border BORDER = BorderFactory.createLoweredBevelBorder();

        public static final int FRAME_WIDTH = 840;  //default width of the simulator
        public static final int FRAME_HEIGHT = 520; //default height of the simulator

        public static final int SIM_PANEL_WIDTH = 600;
        public static final int SIM_PANEL_HEIGHT = 500;

        public static final int STATUS_PANEL_WIDTH = 600;
        public static final int STATUS_PANEL_HEIGHT = 100;

        public static final int INSTRUCTION_PANEL_WIDTH = 240;
        public static final int INSTRUCTION_PANEL_HEIGHT = 130;

        public static final int PARAMETER_PANEL_WIDTH = 240;
        public static final int PARAMETER_PANEL_HEIGHT = 100;

        public static final int MICROCODE_PANEL_WIDTH = 240;
        public static final int MICROCODE_PANEL_HEIGHT = 270;

        public static final int REGISTER_WIDTH = 42;
        public static final int REGISTER_HEIGHT = 20;
    }

    public static final class drawable {
        public static final String DRAWABLE_PATH = attribute.DEBUG_PATH + "\\src\\trunk\\res\\drawable";  //path to store drawable stuff, also end WITHOUT a file separator

        public static final ImageIcon LOGO = new ImageIcon(DRAWABLE_PATH + "\\logo.png"); //logo to display in the title bar of the simulator frame

        private static final float dash[] = {10.0f};
        public static final BasicStroke STROKE_DEFAULT = new BasicStroke(2.0f);
        public static final BasicStroke STROKE_DASHED = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f);

    }

    public static final class string {
        public static final String APP_NAME = "Instruction Flow Simulator"; //app name will be displayed in the title bar of the simulator
        public static final String APP_VERSION = "2.1"; //set a version to maintain a uniformity
        public static final String SIMULATE_PANEL = "Simulate Panel";   //name for simulate panel
        public static final String PARAMETER_PANEL = "Parameter Panel"; //name for the parameter panel

        //String array for $InstructionPanel$
        public static final String[] INSTRUCTION_TYPE = {"传送指令","单操作数指令","双操作数指令","程序控制类指令"};

        public static final String[] INSTRUCTION_TRANSFER = {"MOV"};
        public static final String[] INSTRUCTION_SINGLE = {"COM","NEG","INC","DEC","SL","SR"};
        public static final String[] INSTRUCTION_DOUBLE = {"ADD","SUB","AND","OR","EOR"};
        public static final String[] INSTRUCTION_CONTROL = {"JMP","RST","JSR"};

        public static final String[][] INSTRUCTION = {INSTRUCTION_TRANSFER,INSTRUCTION_SINGLE,INSTRUCTION_DOUBLE,INSTRUCTION_CONTROL};

        public static final String[] SOURCE_OPERAND_ADDRESS_MODE = {"R","(R)","-(R)","I/(R)+","@(R)+","X(R)"};
        public static final String[] TARGET_OPERAND_ADDRESS_MODE = {"R","(R)","-(R)","(R)+","@(R)+","X(R)"};

    }

    public static final class color {
        public static final Color NORMAL = Color.black; //color for paint component in normal Status
        public static final Color ACTIVE = Color.green; //color for paint component in active Status
        public static final Color EMPHASIZE = Color.red;    //color to emphasize a component in simulate panel
    }

    public static final class file {
        public static final File INSTRUCTION = new File(attribute.DEBUG_PATH,"src\\trunk\\res\\instruction.txt");
        public static final File MICROCODE = new File(attribute.DEBUG_PATH,"src\\trunk\\res\\microcode.txt");
        public static final File ACTION = new File(attribute.DEBUG_PATH,"src\\trunk\\res\\action.txt");
    }

    /*test case*/
    public static void main(String[] args) {
        System.out.println(attribute.DEBUG_PATH);
    }
}
